function AccountsFilterView(div, accFilter, accounts) {

	var self = this;
	this.accountsMap = { null: '*' };

	this.swapAccounts = function() {
		var srcValue = this.srcCombo.value;
		var dstValue = this.dstCombo.value;
		if(!areSame(srcValue, dstValue)) {
			this.srcCombo.selectById(dstValue.id);
			this.dstCombo.selectById(srcValue.id);
		}
	};

	this.addAccounts = function() {
		var srcValue = this.srcCombo.value;
		var dstValue = this.dstCombo.value;
		if(!areSame(srcValue, dstValue) && accFilter.add(srcValue, dstValue)) {
			this.renderTable();
		}
	};

	this.removeAccounts = function(index) {
		if(accFilter.remove(index)) {
			this.renderTable();
		}
	};

	this.renderTable = function() {
		var html = '<table width="100%">';
		$.each(accFilter.srcDstList, function(index, srcDst) {
			html += '<tr>' +
				'<td style="min-width: 110px;">' + self.accountsMap[srcDst.srcId] + '</td>' +
				'<td style="min-width: 24px;">&rightarrow;</td>' +
				'<td style="min-width: 110px;">' + self.accountsMap[srcDst.dstId] + '</td>' +
				'<td><input id="' + div + index + '" type="button" value="X"/></td></tr>';
		});
		html += '</table>';
		el(div + 'Table').html(html);
		$.each(accFilter.srcDstList, function(index, srcDst) {
			createSimpleButton(div + index, 24, 24, function() {
				self.removeAccounts(index);
			});
		});
	};

	//construction
	this.srcCombo = new ComboView({
		width: 110,
		valueProp: 'id',
		nullItem: { id: null, name: '*' },
		requestEvent: 'accounts-request',
		updateEvent: 'accounts-loaded'
	});
	this.dstCombo = new ComboView({
		width: 110,
		valueProp: 'id',
		nullItem: { id: null, name: '*' },
		requestEvent: 'accounts-request',
		updateEvent: 'accounts-loaded'
	});

	el(div).html('<table><tr>' +
		'<td colspan="2" class="label-small">со счета</td>' +
		'<td colspan="2" class="label-small">на счет</td>' +
		'</tr><tr>' +
		'<td><div id="' + div + 'Src"></div></td>' +
		'<td><input id="' + div + 'SwapBtn" type="button" value="&#x21C6;" /></td>' +
		'<td><div id="' + div + 'Dst"></div></td>' +
		'<td><input id="' + div + 'AddBtn" type="button" value="+" /></td>' +
		'</tr></table><div id="' + div + 'Table"></div>');

	this.srcCombo.render(div + 'Src');
	this.dstCombo.render(div + 'Dst');
	createSimpleButton(div + 'SwapBtn', 24, 24, function() {
		self.swapAccounts();
	});
	createSimpleButton(div + 'AddBtn', 24, 24, function() {
		self.addAccounts();
	});

	var updateAccounts = function(accounts) {
		$.each(accounts, function(index, account) {
			self.accountsMap[account.id] = account.name;
		});
		accFilter.filter(self.accountsMap);
		self.renderTable();
	};
	$.subscribe('accounts-loaded', function(event, data) {
		updateAccounts(data.items);
	});
	updateAccounts(accounts);
};